import java.util.*;

class Pair{
    private char first;
    private int second;

    public Pair(char first, int second) {
        this.first = first;
        this.second = second;
    }

    public char getFirst() {
        return first;
    }

    public void setFirst(char first) {
        this.first = first;
    }

    public int getSecond() {
        return second;
    }

    public void setSecond(int second) {
        this.second = second;
    }
}
public class _2023_10_26 {

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        HashMap<Character, Integer> hash = new HashMap<>();
        char[] s = str.toCharArray();
        List<Pair> arr = new ArrayList<>();
        for(int i = 0; i < s.length; i++){
            if(hash.containsKey(s[i])){
                int index = hash.get(s[i]);
                Pair oldPair = arr.get(index);
                Pair newPair = new Pair(oldPair.getFirst(), oldPair.getSecond()+1);
                arr.set(index, newPair);
            }else {
                    hash.put(s[i], arr.size());
                    arr.add(new Pair(s[i], 1));
            }
        }
        for(Pair e : arr){
            if(e.getSecond() == 1){
                System.out.println(e.getFirst());
                return;
            }
        }
        System.out.println(-1);
    }

    private static int gcd(int a, int b){
        while(a % b != 0){
            int tmp = a % b;
            a = b;
            b = tmp;
        }
        return b;
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()){
            int n = sc.nextInt();
            int a = sc.nextInt();
            int[] arr = new int[n];
            for(int i = 0; i < arr.length; i++ ){
                arr[i] = sc.nextInt();
                if(a >= arr[i]){
                    a += arr[i];
                }else{
                    a += gcd(a, arr[i]);
                }
            }
            System.out.println(a);
        }

    }
}
